/* hal_IPC.h */
#ifndef __HAL_IPC_H__
#define __HAL_IPC_H__

#include "hal_common.h"

typedef enum
{   
    IPC_Periph_DMA          =  8u,
    IPC_Periph_DIVSQRT      = 14u,
    IPC_Periph_GPIO         = 15u,
    IPC_Periph_EMU          = 24u,
    IPC_Periph_EFM          = 32u,
    IPC_Periph_FlexCAN0     = 36u,
    IPC_Periph_SPI0         = 44u,
    IPC_Periph_SPI1         = 45u,
    IPC_Periph_SPI2         = 46u,
    IPC_Periph_CRC          = 50u,
    IPC_Periph_pTMR0        = 55u,
    IPC_Periph_eTMR0        = 56u,
    IPC_Periph_eTMR1        = 57u,
    IPC_Periph_eTMR2        = 58u,
    IPC_Periph_ADC0         = 59u,
    IPC_Periph_RTC          = 61u,
    IPC_Periph_lpTMR0       = 64u,
    IPC_Periph_CIM          = 72u,
    IPC_Periph_PCTRLA       = 73u,
    IPC_Periph_PCTRLB       = 74u,
    IPC_Periph_PCTRLC       = 75u,
    IPC_Periph_PCTRLD       = 76u,
    IPC_Periph_PCTRLE       = 77u,
    IPC_Periph_WDG          = 82u,
    IPC_Periph_TMU          = 99u,
    IPC_Periph_SCU          =100u,
    IPC_Periph_I2C0         =102u,
    IPC_Periph_I2C1         =103u,
    IPC_Periph_UART0        =106u,
    IPC_Periph_UART1        =107u,
    IPC_Periph_UART2        =108u,
    IPC_Periph_ACMP0        =115u,
    IPC_Periph_PCU          =125u,
    IPC_Periph_RCU          =127u,

} IPC_Periph_Type;

typedef enum
{
    IPC_PeriphFunClkSrc_NONE  = 0u,
    IPC_PeriphFunClkSrc_FIRC  = 1u,
    IPC_PeriphFunClkSrc_SIRC  = 2u,
    IPC_PeriphFunClkSrc_FXOSC = 3u,
    IPC_PeriphFunClkSrc_SXOSC = 4u,
    IPC_PeriphFunClkSrc_LPO   = 5u,
} IPC_PeriphFunClkSrc_Type;

typedef enum
{
    IPC_PeriphFunClkDiv_1  = 0u,
    IPC_PeriphFunClkDiv_2  = 1u,
    IPC_PeriphFunClkDiv_3  = 2u,
    IPC_PeriphFunClkDiv_4  = 3u,
    IPC_PeriphFunClkDiv_5  = 4u,
    IPC_PeriphFunClkDiv_6  = 5u,
    IPC_PeriphFunClkDiv_7  = 6u,
    IPC_PeriphFunClkDiv_8  = 7u,
    IPC_PeriphFunClkDiv_9  = 8u,
    IPC_PeriphFunClkDiv_10 = 9u,
    IPC_PeriphFunClkDiv_11 = 10u,
    IPC_PeriphFunClkDiv_12 = 11u,
    IPC_PeriphFunClkDiv_13 = 12u,
    IPC_PeriphFunClkDiv_14 = 13u,
    IPC_PeriphFunClkDiv_15 = 14u,
    IPC_PeriphFunClkDiv_16 = 15u,
    
    IPC_PeriphFunClkDiv_NONE = 0u,
} IPC_PeriphFunClkDiv_Type;

typedef struct
{
    IPC_PeriphFunClkSrc_Type Source;
    IPC_PeriphFunClkDiv_Type Div;
} IPC_PeriphFunClk_Type;


void IPC_ResetPeriph(IPC_Type * base, IPC_Periph_Type periph);
void IPC_EnablePeriph(IPC_Type * base, IPC_Periph_Type periph , IPC_PeriphFunClkSrc_Type src, IPC_PeriphFunClkDiv_Type div);

#endif /* __HAL_IPC_H__ */
